package YAPenvironment;

/**
 * This Class is used for the Server-Client communication.
 * It identifies the errorCode and returns an errormessage
 */
public class YAPerrorCode {
	
	/**
	 * Identifies the errorcode and rreturns the errormessage
	 * @param Errorcode
	 * @return Errormessage
	 */
	public static String getErrorMsg(Integer code){
		switch(code){
		case  0: return "ok";
		case -1: return "Name already exists";
		case -2: return "There are no lobbies yet";
		case -3: return "Lobby is already full";
		case -4: return "Lobby no longer exists";
		case -5: return "Lobby was closed";
		case -6: return "The number of players must be equal or less to the number of sides";
		case -7: return "A lobby with this name already exists";
//		case -8: return "Kann nicht zur Lobby connecten, Spiel wurde bereits gestartet";
		case -9: return "Only the lobby host may change the playing area";
		case -10: return "Lobby could not be opened. Some of the parameters do not match";
		case -11: return "Your name cannot contain any spaces or tabulators";
		case -12: return "Name too long. Maximum is 16 characters";
		case -13: return "Name too short. Minimum is 4 characters";
		case -14: return "Connection failed or the protocol is faulty";
		case -15: return "Lobby could not be found";
		case -21: return "You are ready"; //terrible terrible damage
		case -22: return "Too many players on the server";
		
//		case -30: return "Spiel kann nicht gestartet werden. Es sind nicht alle Spieler bereit";
//		case -31: return "Nur der Lobby-Host kann das Spiel starten.";
		case -32: return "You cannot play this game alone.";
//		case -33: return "Nur der Lobby-Host kann Spieler aus der Lobby kicken";
		
		case -40: return "Lobby name is too short";
		case -41: return "Lobby name is too long";
		case -42: return "Lobby name must not contain any spaces or tabulators";
		case -43: return "Lobby name already exists";
		case -44: return "A game must have 2-8 players";
		case -45: return "Lobby cannot be found";
		case -46: return "You are already in a lobby";
		case -47: return "You are not in a lobby (yet)";
		
//		case -50: return "Konnte Spieler nicht fluestern";
		case -99: return "Command is not in the protocol";
		case -100: return "Player does not exist";
		case -101: return "Couldn't open PDF. Try to open the archive with winzip or 7zip and look for it there manually";
		case -102: return "Couldn't load manual.";
		
		case -200: return "Port out of range";
		}
		return "ohoh: "+code.toString();
	}

}
